//列表数据
import { FormSchema } from '@/components/Form';
import { BasicColumn } from '@/components/Table';
import { JVxeTypes } from '@/components/jeecg/JVxeTable/src/types';
import { render } from '@/utils/common/renderUtils';

export const columns: BasicColumn[] = [
  {
    title: '模板名称',
    align: 'center',
    dataIndex: 'templateName',
  },
  {
    title: '收费类型',
    align: 'center',
    dataIndex: 'calculateType',
    customRender: ({ value }) => {
      return render.renderDict(value, 'calculate_type');
    },
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '模板名称',
    field: 'templateName',
    component: 'JInput',
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '模板名称',
    field: 'templateName',
    component: 'Input',
    required: true,
  },
  {
    label: '收费类型',
    field: 'calculateType',
    component: 'JSearchSelect',
    required: true,
    componentProps: {
      dict: 'calculate_type',
    },
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
export const feeRuleColumns = [
  {
    title: 'ID',
    key: 'id',
    type: JVxeTypes.hidden,
  },
  {
    title: '地区',
    key: 'deliveryAreas',
    type: JVxeTypes.pca,
    width: 180,
  },
];

// 高级查询数据
export const superQuerySchema = {
  templateName: { title: '模板名称', order: 1, view: 'text', type: 'string' },
  calculateType: { title: '收费类型', order: 2, view: 'text', type: 'string' },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
